class Student:
    """
    定义属性
    """
    name = None
    gender = None
    nationality = None
    native_place = None
    age = None

    """
    成员方法
    self 参数必须存在，用来表示类对象自身的意思
    当我们使用类对象调用方法时候，self会被python自动传入
    self是透明的，可以不用理会它
    """

    def say_hi(self, msg: str):
        print(f"{self.name}说：{msg}")


# 创建对象
stu1 = Student()
# 属性赋值
stu1.age = 10
stu1.native_place = "安徽"
stu1.name = "张三"
stu1.gender = "男"
stu1.nationality = "中国"

print(stu1.name)

stu1.say_hi("Hello")


class Clock:
    id: int = None
    price: float = None

    def ring(self):
        import winsound  # 闹钟
        winsound.Beep(5000, 3000)  # 闹钟响铃


ck1 = Clock()
ck1.id = 1
ck1.price = 15.5
print(f"闹钟的id->{ck1.id},价格->{ck1.price}")
ck1.ring()
